{% extends "admin/base_site.html" %}
{% load i18n filer_admin_tags %}

{% block breadcrumbs %}
{% include "admin/filer/breadcrumbs.html" %}
{% endblock %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_css_base %}forms.css" />{% endblock %}

{% block content %}
{% if perms_lacking %}
    <div class="alert alert-danger">{% blocktrans %}Your account doesn't have permissions to rename all of the selected files.{% endblocktrans %}</div>
{% else %}
{% if not to_rename %}
    <div class="alert alert-info">{% blocktrans %}There are no files available to rename.{% endblocktrans %}</div>
{% else %}
    <form action="" method="post">{% csrf_token %}
    <div class="alert alert-block alert-info">{% blocktrans %}The following files will be renamed (they will stay in their folders and keep original filename, only displayed filename will be changed):{% endblocktrans %}
    <ul>{{ to_rename|unordered_list }}</ul>
    {% for f in files_queryset %}
    <input type="hidden" name="{{ action_checkbox_name }}" value="file-{{ f.pk }}" />
    {% endfor %}
    {% for f in folders_queryset %}
    <input type="hidden" name="{{ action_checkbox_name }}" value="folder-{{ f.pk }}" />
    {% endfor %}
    <input type="hidden" name="action" value="rename_files" />
    <input type="hidden" name="post" value="yes" />
    <br>
    {{ rename_form.as_p_with_help }}

    <p><input type="submit" value="{% trans "Rename" %}" class="btn btn-info" /></p>
    </div>
    </form>
    <div class="help box">
    <p>Rename format is in <a href="http://docs.python.org/library/stdtypes.html#string-formatting-operations">Python % operator format</a> using dictionary of possible values:</p>
    <dl>
    <dt>original_filename</dt>
    <dt>original_basename</dt>
    <dd>Original filename without possible file extension.</dd>
    <dt>original_extension</dt>
    <dt>current_filename</dt>
    <dt>current_basename</dt>
    <dd>Current filename without possible file extension.</dd>
    <dt>current_extension</dt>
    <dt>current_folder</dt>
    <dd>Name of the folder the file is currently in.</dd>
    <dt>counter</dt>
    <dd>Renaming sequence counter in the current folder (1-based).</dd>
    <dt>global_counter</dt>
    <dd>Renaming squence counter for all files currently renaming (1-based).</dd>
    </dl>
    <p>Examples:</p>
    <ul>
    <li><code>Prefix %(current_filename)s</code></li>
    <li><code>Image %(counter)03d</code></li>
    </ul>
    </div>
{% endif %}
{% endif %}
{% endblock %}
